package com.example.lenovo.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private List<pep> pepList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initpeps();//初始化水果数据
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.weChat_list);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        WechatAdapter adapter = new WechatAdapter(pepList);
        recyclerView.setAdapter(adapter);
    }

    private void initpeps() {
        for(int i = 0; i < 10; i++) {
            pep peps1 = new pep("用户1" + i, R.mipmap.profile_pressed);
            pep peps2 = new pep("用户2" + i, R.mipmap.profile_normal);
            pepList.add(peps1);
            pepList.add(peps2);
        }
    }
}
